# -*- mode: snippet -*-
# name: gls from nlme Fit Linear Model Using Generalized Least Squares
# key: nlme.gls
# key: gls
# contributor : Shuguang Sun
# --
res.$1 <- nlme::gls(model       = $2,
              data        = $1,
              ## Covariance structure
              correlation = corSymm(form = ~ as.numeric(${3: time.cat}) | ${4: id}),
              ## Variance structure
              weights     = varIdent(form = ~ 1 | ${3: time.cat}),
              method      = "REML"
              )
summary($1)
intervals($1)
getVarCov($1)